#region Copyright Jonathan Quiros

//	
// All rights are reserved. Reproduction or transmission in whole or in 
// part, in any form or by any means, electronic, mechanical or otherwise, 
// is prohibited without the prior written consent of the copyright owner.
//
// Filename: BaseLogic.cs
//

#endregion

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using Ids.Utils;

namespace Novagoal.Logic
{
    public abstract class BaseLogic
    {
        #region CONSTANTS



        #endregion

        #region PROPERTIES

        

        #endregion

        #region PUBLIC METHODS

        /// <summary>
        /// Parses the filters.
        /// </summary>
        /// <typeparam name="TEnumType">The type of the enum type.</typeparam>
        /// <param name="collection">The collection.</param>
        /// <returns></returns>
        protected Dictionary<TEnumType, string> ParseFilters<TEnumType>(NameValueCollection collection)
        {
            var filters = new Dictionary<TEnumType, string>();

            foreach (TEnumType item in Enum.GetValues(typeof(TEnumType)))
            {
                var enumObject = item as Enum;
                string value = collection[enumObject.ToStringValue()];
                if (!string.IsNullOrEmpty(value))
                    filters.Add(item, value);
            }
            return filters;
        }

        #endregion

        #region PRIVATE METHODS



        #endregion
    }
}